import java.util.StringTokenizer;


class P11461_39643 {

	static int[] results = new int[100001];
	
	public static void main(String[] args) {
		
		int count = 0;
		for (int k = 0; k < 100001; k++) {
			
			int t = (int) Math.sqrt(k);
			
			if (t * t == k) count++;
			
			results[k] = count;
			
		}
		
		while (true) {
			int a, b;
			
			StringTokenizer st = new StringTokenizer(readLn());
			
			a = Integer.parseInt(st.nextToken());
			b = Integer.parseInt(st.nextToken());
			
			if (a == 0 && b == 0) break;
			
			System.out.println(results[b] - results[a-1]);
			
			
		}
		
	}
	
	  static String readLn() {
	        String newLine = System.getProperty("line.separator");
	        StringBuffer buffer = new StringBuffer();
	        int car = -1;
	        try {
	            car = System.in.read();
	            while ((car > 0) && (car != newLine.charAt(0))) {
	                buffer.append((char) car);
	                car = System.in.read();
	            }
	            if (car == newLine.charAt(0))
	                System.in.skip(newLine.length() - 1);
	        } catch (java.io.IOException e) {
	            return (null);
	        }
	        if ((car < 0) && (buffer.length() == 0))
	            return (null);
	        return (buffer.toString()).trim();
	    }
	
}
